package cn.calin.day05.demo31StringBuilder;
/*
    StringBuilder和String可以相互转换
        String->StringBuilder(String str)
            StringBuilder(String str)构造一个字符串生成器，并初始化为指定的字符串内容
        StringBuilder->String:可以使用StringBUilder中的toString方法

 */
public class Demo03StringBuilder {
    public static void main(String[] args) {
        //String->StringBuilder
        String str="Hello";
        System.out.println("str："+str);
        StringBuilder builder=new StringBuilder(str);
        //往StringBuilder中添加数据
        builder.append("world");
        System.out.println("bu:"+builder);

        //StringBuilder->String
        String s= builder.toString();
        System.out.println("s:"+s);
    }
}
